<?php
require_once(dirname(__FILE__)."/../../libs/dbclass/dbconnect.php");
require_once(dirname(__FILE__)."/../../libs/string/libstr.php");
$mc= new libstr();

class config{
	
	//获取标记列表
	function getmarks($type=""){
		global $db;
		global $mc;
		$_where=" isshow >=0";
		if($mc->Ismp($type)!=""){
			$_where.=" and type='".$type."'";
		}
		$mk=$db->ds("select * from mark_content where".$_where." order by classorder asc");
		return $mk;
	}
	//修改标记
	function mark_edit($id,$classname="",$classvalue="",$classorder=0){
		global $db;
		global $mc;
		$mk=array();
		$mk["classname"]=$classname;
		$mk["classvalue"]=$classvalue;
		$mk["classorder"]=$classorder;
		$db->update_data("mark_content",$mk,"ID=".$id);
		return true;	
	}
	//删除标记
	function mark_del($id){
		global $db;
		global $mc;
		$db->cmd("delete from mark_content where ID=".$id);
		return true;	
	}
	//添加标记
	function mark_add($classname="",$classvalue="",$classorder=0,$type="article"){
		global $db;
		global $mc;
		$mk=array();
		$mk["classname"]=$classname;
		$mk["classvalue"]=$classvalue;
		$mk["classorder"]=$classorder;
		$mk["type"]=$type;
		$db->add_data("mark_content",$mk);
		return true;	
	}
	
	//更新网站信息
	function updatemsg($webname="",$logo="",$banquan="",$keyword="",$miaoshu="",$beian="",$tongji,$kfqq){
		global $db;
		$msg=array();
		$msg["webname"]=$webname;
		$msg["logo"]=$logo;
		$msg["keyword"]=$keyword;
		$msg["miaoshu"]=$miaoshu;
		$msg["banquan"]=$banquan;
		$msg["beian"]=$beian;
		$msg["tongji"]=$tongji;
		$msg["kfqq"]=$kfqq;
		$db->update_data("webmessage",$msg);
		return true;
	}
	
	//获得网站信息
	function getwebmsg(){
		global $db;
		$msg=$db->ds("select * from webmessage limit 1");
		return $msg[0];
	}
	
	//获得某个表数据 
	function getInfo($table,$condition=''){
		global $db;
		$msg=$db->ds("select * from ".$table.$condition." limit 1");
		return $msg[0];
	}
	
	//获得某个表
	function getInfos($table,$condition=''){
		global $db;
		$msg=$db->ds("select * from ".$table.$condition);
		return $msg;
	}
	
	//获得广告图列表,type为广告图类型
	function getadimg($type="index"){
		global $db;
		$img=$db->ds("select * from img_content where type='".$type."' order by position asc");
		return $img;
	}
	//广告图详细
	function getimgshow($id){
		global $db;
		$show=$db->ds("select * from img_content where id=".$id." limit 1");
		return $show[0];
	}
	//添加广告图
	function addadimg($topicname="",$url="",$files="",$isshow=1,$classorder="",$content="",$type="index",$position){
		global $db;
		global $mc;
		$img=array();
		$img["topicname"]=$topicname;
		$img["url"]=$url;
		$img["files"]=$files;
		$img["isshow"]=$isshow;
		$img["classorder"]=$classorder;
		$img["content"]=$content;
		$img["createtime"]=date("Y-m-d H:i:s",time());
		$img["type"]=$type;
		$img["position"]=$position;
		$db->add_data("img_content",$img);
		return true;	
		
	}
	
	//更改广告图
	function updateadimg($id,$topicname="",$url="",$files="",$isshow=1,$classorder="",$content="",$type="index",$position){
		global $db;
		$img=array();
		$img["topicname"]=$topicname;
		$img["url"]=$url;
		$img["files"]=$files;
		$img["isshow"]=$isshow;
		$img["classorder"]=$classorder;
		$img["content"]=$content;
		$img["type"]=$type;
		$img["position"]=$position;
		$db->update_data("img_content",$img,"id=".$id);
		return true;
	}
	
	//删除广告图
	function deladimg($id){
		
		global $db;
		$db->cmd("delete from img_content where id=".$id);
		return true;	
		
	}
	
	
}

?>